package com.safe.first.domain.order.factory;

import com.safe.first.domain.order.model.GoodsOrder;
import com.safe.first.domain.order.service.OrderPriceService;
import com.safe.first.domain.spu.Sku;
import com.safe.first.domain.user.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Set;

/**
 * @author Mickey
 * @since 2022/5/28
 **/
@Component
@AllArgsConstructor
public class GoodsOrderFactory implements OrderFactory<GoodsOrder, GoodsOrderFactory.CreateGoodsOrderParam> {

    private final OrderPriceService orderPriceService;

    @Override
    public GoodsOrder instance(CreateGoodsOrderParam createGoodsOrderParam, User user) {
        return new GoodsOrder(orderPriceService, user, createGoodsOrderParam);
    }

    @Data
    public static class CreateGoodsOrderParam {

        private Long addressId;
        private List<CreateGoodsOrderSku> skus;

    }

    @Data
    public static class CreateGoodsOrderSku implements Sku {

        private Long id;

    }

}
